package com.k8.common.ioc.injectorImpl;

import com.k8.common.ioc.Injector;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

/**
 * injector的安全持有者，避免暴露给用户时被错误使用
 **/
public class SafeInjectorHolder implements Injector {
    private Injector injector;

    public SafeInjectorHolder(Injector injector) {
        this.injector = injector;
    }

    @Override
    public boolean inject(Map<String, Object> relyBeanMaps, Object object, Field field) {
        return false;
    }

    @Override
    public boolean needInject(Field field) {
        return false;
    }

    @Override
    public void synJudge(Map<String, Object> relyBeanNames) {

    }

    @Override
    public <T> T getBean(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz, String name) {
        return this.injector.getBean(relyBeanMaps, clazz, name);
    }

    @Override
    public <T> T getBean(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz) {
        return this.injector.getBean(relyBeanMaps, clazz);
    }

    @Override
    public <T> T getBeanOrRegistry(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz, String name) {
        return this.injector.getBeanOrRegistry(relyBeanMaps, clazz, name);
    }

    @Override
    public <T> T getBeanOrRegistry(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz) {
        return this.injector.getBeanOrRegistry(relyBeanMaps, clazz);
    }

    @Override
    public <T> List<T> getAllBeans(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz) {
        return this.injector.getAllBeans(relyBeanMaps, clazz);
    }

    @Override
    public <T> T getAdaptive(Map<String, SafeObjectHolder> relyBeanMaps, Class<T> clazz) {
        return this.injector.getAdaptive(relyBeanMaps, clazz);
    }
}
